﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGePosition2d : OdGePointEnt2d
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGePosition2d(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGePosition2d_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGePosition2d obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGePosition2d()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGePosition2d(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdGePosition2d() : this(GlobalsPINVOKE.new_OdGePosition2d__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePosition2d(OdGePoint2d point) : this(GlobalsPINVOKE.new_OdGePosition2d__SWIG_1(OdGePoint2d.getCPtr(point)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePosition2d(double x, double y) : this(GlobalsPINVOKE.new_OdGePosition2d__SWIG_2(x, y), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePosition2d(OdGePosition2d source) : this(GlobalsPINVOKE.new_OdGePosition2d__SWIG_3(OdGePosition2d.getCPtr(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePosition2d set(OdGePoint2d point)
		{
			OdGePosition2d result = new OdGePosition2d(GlobalsPINVOKE.OdGePosition2d_set__SWIG_0(this.swigCPtr, OdGePoint2d.getCPtr(point)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePosition2d set(double x, double y)
		{
			OdGePosition2d result = new OdGePosition2d(GlobalsPINVOKE.OdGePosition2d_set__SWIG_1(this.swigCPtr, x, y), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePosition2d Assign(OdGePosition2d pos)
		{
			OdGePosition2d result = new OdGePosition2d(GlobalsPINVOKE.OdGePosition2d_Assign(this.swigCPtr, OdGePosition2d.getCPtr(pos)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
